﻿using System;
using System.Text;
using System.Collections.Generic;
using System.Linq;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Netcached.Tests
{
    [TestClass]
    public class TestCompression : BaseTestClass
    {
        [TestMethod]
        public void DeflateCompression()
        {
            Client.CompressionThreshold = 2;

            string key = "TestCompression.DeflateCompression";
            string value = "TestValue123123";

            Client.Set(key, value);

            string fetchedValue = Client.Get<string>(key);

            Assert.AreEqual(value, fetchedValue);
        }

        [TestMethod]
        public void GZipCompression()
        {
            Client.CompressionThreshold = 2;
            Client.CompressionAlgorithm = CompressionAlgorithm.GZip;

            string key = "TestCompression.GZipCompression";
            string value = "TestValue123123";

            Client.Set(key, value);

            string fetchedValue = Client.Get<string>(key);

            Assert.AreEqual(value, fetchedValue);
        }
    }
}
